<script setup lang="ts">
import { ref } from "vue";
import { useRoute } from "vue-router";
import { tabsList } from "./helps";

import RiskSummary from "./components/riskSummary.vue";
import WorkOrderPush from "./components/workOrderPush.vue";
import NotificationRanking from "./components/notificationRanking.vue";
import Whitelist from "./components/WhiteList/index.vue";
import AlarmCenter from "./components/AlarmCenter/index.vue";
import Dashboard from "./components/Dashboard.vue";
import TicketManagement from "./components/TicketManagement/index.vue";

const route = useRoute();

// 获取URL参数中的task（如果有的话）
const taskParam = ref((route.query.task as string) || "");
</script>

<template>
  <div>
    <el-tabs type="border-card">
      <el-tab-pane label="仪表盘" value="0">
        <Dashboard :task="taskParam" />
      </el-tab-pane>
      <el-tab-pane label="风险汇总" value="1">
        <RiskSummary :task="taskParam" />
      </el-tab-pane>
      <el-tab-pane label="白名单管理" value="2">
        <Whitelist :task="taskParam" />
      </el-tab-pane>
      <el-tab-pane label="告警审核中心" value="3">
        <AlarmCenter :task="taskParam" />
      </el-tab-pane>
      <el-tab-pane label="工单管理" value="4">
        <TicketManagement :task="taskParam" />
      </el-tab-pane>

      <!-- <el-tab-pane
        v-for="item in tabsList"
        :key="item.value"
        :label="item.label"
        :value="item.value"
      >
        <div
          v-if="taskParam"
          style="display: flex; justify-content: space-between"
        >
          <div class="task-name">任务名称：{{ taskParam }}</div>
        </div>
        <RiskSummary v-if="item.key === 'risk_summary'" :task="taskParam" />
        <WorkOrderPush
          v-if="item.key === 'work_order_push'"
          :task="taskParam"
        />
        <NotificationRanking
          v-if="item.key === 'notification_ranking'"
          :task="taskParam"
        />
      </el-tab-pane> -->
    </el-tabs>
  </div>
</template>

<style lang="scss" scoped>
.search-form-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.search-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.el-btn-zese {
  background: #722ed1;
  color: white;
  border-color: #722ed1;
}

.el-btn-zese.is-disabled,
.el-btn-zese.is-disabled:focus,
.el-btn-zese.is-disabled:hover {
  background: #722ed1;
  color: white;
  border-color: #722ed1;
}

.task-name {
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 10px;
  border: 1px solid #e0e0e0;
  padding: 10px;
  border-radius: 5px;
}
</style>
